<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-03 01:13:27
 * @LastEditTime: 2023-07-03 12:59:39
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: 
 */

namespace App\Models;

class Department extends BaseModel
{
    public $table = "basedata_department";
    protected $guarded = [];
    public function childrentree()
    {
        return $this->hasMany(get_class($this), 'parent_id', 'id');
    }
    public function children()
    {
        return $this->childrentree()->with(["children", 'financedepartment']);
    }
    public function financedepartment()
    {
        return $this->belongsTo(FinanceDepartment::class);
    }
}
